package com.wutao.panzh.admin.service.Impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.panzh.entity.RouteImag;
import com.wutao.panzh.admin.mapper.RouteImagMapper;
import com.wutao.panzh.service.RouteImagService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class RouteImagServiceImple implements RouteImagService {

    @Autowired
    private RouteImagMapper routeImagMapper;

    @Override
    public void removeImagByRouteIdAndImagSrc(String imagSrc, String routeId) {
        RouteImag routeImag = new RouteImag();
        routeImag.setRouteId(Integer.parseInt(routeId));
        routeImag.setRouteImagUrl(imagSrc);
        routeImagMapper.delete(routeImag);
    }

    @Override
    public List<RouteImag> getAllRouteImagByRouteId(String routeId) {
        //不得不说，通用mapper确实是个好东西；
        RouteImag routeImag = new RouteImag();
        routeImag.setRouteId(Integer.parseInt(routeId));
        List<RouteImag> imags = routeImagMapper.select(routeImag);
        return imags;
    }
}
